package com.film.admincontroller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.Film;
import com.film.domain.FilmOffice;
import com.film.domain.FilmShowings;
import com.film.service.FilmOfficeService;
import com.film.service.FilmService;
import com.film.service.ShowingsService;
import com.film.service.impl.FilmOfficeServiceImpl;
import com.film.service.impl.FilmServiceImpl;
import com.film.service.impl.ShowingsServiceImpl;
@WebServlet("/filmShowings.do")
public class FilmShowingsController extends HttpServlet{
	private ShowingsService showingsService = new ShowingsServiceImpl();
	private FilmService filmService = new FilmServiceImpl();
	private FilmOfficeService filmOfficeService = new FilmOfficeServiceImpl();
	 
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		//查询所有的排期信息
		List<FilmShowings> filmShowings = showingsService.selectAllShowings(0);
		//查询所有上映的电影
		List<Film> showingsFilms = filmService.selectHotFilm();
		//查询所有的影厅
		List<FilmOffice> showingsOffice = filmOfficeService.selectAllOffice();
		
		session.setAttribute("filmShowings", filmShowings);
		session.setAttribute("showingTemp", filmShowings);
		session.setAttribute("filmShowingSize", filmShowings.size());
		session.setAttribute("showingsFilms", showingsFilms);
		session.setAttribute("showingsOffice", showingsOffice);
		response.sendRedirect("admin_jsp/filmShowings.jsp?flag=1");
		
	}
}
